<template>
  <view class="teamContent">
    <view class="teamContent-title">
      <!-- <view class="teamContent-title__name"> {{ title }} </view> -->
      <view class="teamContent-title__num"> {{ num }}人 </view>
    </view>
    <view class="teamContent-list">
      <template v-for="item in team">
        <view :key="item" class="user">
          <image :src="item.headavatar" mode="aspectFill" class="user-avatar" />
          <view class="user-name">{{ item.name }}</view>
        </view>
      </template>
    </view>
    <!-- <view class="teamContent-expand" @click.stop="toggle">
      {{ list.length == 5 ? "展开" : "收起" }}
    </view> -->
  </view>
</template>
<script>
export default {
  props: {
    title: {
      type: String,
      default: "我的",
    },
    team: {
      type: Array,
    },
  },
  computed: {
    num() {
      return this.team.filter((item) => item).length;
    },
  },

  data() {
    return {
      list: [1, 2, 3, 4, 5],
    };
  },
  methods: {
    // 展开 收起切换
    toggle() {
      this.list.length == 5 ? this.list.push(6) : this.list.unshift();
    },
  },
};
</script>
<style lang="scss" scoped>
.teamContent {
  width: 100%;
  display: flex;
  // align-items: center;
  padding: 30rpx 0 45rpx 0;
  &-title {
    width: 100rpx;
    &__name {
      font-size: 26rpx;
    }
    &__num {
      font-size: 24rpx;
      text-align: center;
      line-height: 80rpx;
    }
  }
  &-list {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    .user {
      width: calc(100% / 5);
      font-size: 24rpx;
      text-align: center;
      &-avatar {
        width: 52rpx;
        height: 52rpx;
        border-radius: 50%;
      }
      &-name {
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
      }
    }
  }
  &-expand {
    width: 100rpx;
    text-align: right;
    color: #aaaaaa;
    font-size: 26rpx;
    line-height: 82rpx;
  }
}
</style>
